package com.jbit.service.impl;

import com.alibaba.druid.sql.PagerUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jbit.mapper.HotEventsMapper;
import com.jbit.pojo.HotEvents;
import com.jbit.service.HotEventsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class HotEventsServiceImpl implements HotEventsService {
    @Resource
    private HotEventsMapper hotEventsMapper;
    @Override
    public PageInfo<HotEvents> getAllByKeyWord(String keyword,Integer pageNum) {
        /*从pageNum开始,每页显示pageSize*/
        PageHelper.startPage(pageNum,2);

        List<HotEvents> hotEventsList = hotEventsMapper.getAllByKeyWord(keyword);
        /*代理模式 aop*/
        PageInfo<HotEvents> pageInfo = new PageInfo<>(hotEventsList);

        return pageInfo;
    }
}
